package xml;

import java.util.HashMap;

public class TestDom4jReadExmple {
	public static void main(String[] args) {
		try {
			// 获取解析完后的解析信息
			HashMap<String, String> hashMap;
			Dom4jReadExmple drb = new Dom4jReadExmple();
			// 遍历整个XML文件
			hashMap = new HashMap<String, String>();
			String n = System.getProperty("user.dir");// 获取当前工程真实路径
			// studentInfo.xml保存学生信息，放在sre目录下
			drb.iterateWholeXML(n + "\\src\\xml\\学生.xml", hashMap);
			for (int i = 0; i < hashMap.size(); i += 6) {
				int j = i / 6;
				System.out.print(hashMap.get("name" + j) + "\t");
				System.out.print(hashMap.get("student-age" + j) + "\t");
				System.out.print(hashMap.get("college" + j) + "\t");
				System.out.print(hashMap.get("college-leader" + j) + "\t");
				System.out.print(hashMap.get("telephone" + j) + "\t");
				System.out.println(hashMap.get("notes" + j) + "\t");
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
